package com.yanqu.road.entity.web;

import com.alibaba.fastjson.JSONObject;
import com.yanqu.road.utils.string.StringUtils;

public class WebLoginParam {
	private String openId;
	private String platform;
	private int phonePlatform;      //0:默认值；1:Android；2:ios
	private String userName;
	private String nickName;
	private String token = "";
	private long serverId = 0;
	private String language = "";
	private String platformUserId = "";
	private String platformUserName = "";
	private String appId = "";
	private String childGameId = "";
	private String invitedCode = "";
	private String packageMark = "";//包体ID

	public WebLoginParam(JSONObject obj) {
		userName = StringUtils.autoToUtf8(obj.getString("userName"));
		nickName = StringUtils.autoToUtf8(obj.getString("nickName"));
		if (obj.getString("openId") != null) {
			openId = StringUtils.autoToUtf8(obj.getString("openId"));
		}
		if (StringUtils.isNullOrEmpty(openId)) {
			openId = userName;
		}
		//平台
		platform = StringUtils.autoToUtf8(obj.getString("platform"));
		//手机平台
		if (obj.getString("phonePlatform") != null) {
			phonePlatform = obj.getIntValue("phonePlatform");
		}

		if (obj.getString("serverId") != null) {
			serverId = obj.getInteger("serverId");
		}
		if (obj.getString("token") != null) {
			token = StringUtils.autoToUtf8(obj.getString("token"));
		}
		if(null != obj.getString("language")){
			language = StringUtils.autoToUtf8(obj.getString("language"));
		}
		if (obj.getString("plaformUserId") != null) {
			platformUserId = StringUtils.autoToUtf8(obj.getString("plaformUserId"));
		}
		if (obj.getString("plaformUserName") != null) {
			platformUserName = StringUtils.autoToUtf8(obj.getString("plaformUserName"));
		}

		if (obj.getString("appId") != null) {
			appId = StringUtils.autoToUtf8(obj.getString("appId"));
		}

		if (obj.getString("childGameId") != null) {
			childGameId = StringUtils.autoToUtf8(obj.getString("childGameId"));
		}

		if (obj.getString("invitedCode") != null) {
			invitedCode = StringUtils.autoToUtf8(obj.getString("invitedCode"));
		}

		if (obj.getString("packageMark") != null) {
			packageMark = StringUtils.autoToUtf8(obj.getString("packageMark"));
		}
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getPlatform() {
		return platform;
	}

	public void setPlatform(String platform) {
		this.platform = platform;
	}

	public int getPhonePlatform() {
		return phonePlatform;
	}

	public void setPhonePlatform(int phonePlatform) {
		this.phonePlatform = phonePlatform;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public long getServerId() {
		return serverId;
	}

	public void setServerId(long serverId) {
		this.serverId = serverId;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public String getLanguage() {
		return language;
	}

	public String getPlatformUserId() {
		return platformUserId;
	}

	public void setPlatformUserId(String platformUserId) {
		this.platformUserId = platformUserId;
	}

	public String getPlatformUserName() {
		return platformUserName;
	}

	public void setPlatformUserName(String platformUserName) {
		this.platformUserName = platformUserName;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getChildGameId() {
		return childGameId;
	}

	public void setChildGameId(String childGameId) {
		this.childGameId = childGameId;
	}

	public String getInvitedCode() {
		return invitedCode;
	}

	public String getPackageMark() {
		return packageMark;
	}
}
